import { VxeGridPropTypes } from '@/components/VxeTable';
import { Tag } from 'ant-design-vue';
import { h } from 'vue';

export default [
  {
    title: '账号名称',
    field: 'account'
  },
  {
    title: '是否成功',
    field: 'success',
    slots: {
      default: ({ row }) => {
        const success = row.success;
        const enable = ~~success === 1;
        const color = enable ? 'green' : 'red';
        const text = enable ? '成功' : '失败';
        return h(Tag, { color: color }, () => text);
      }
    }
  },
  {
    title: 'IP地址',
    field: 'remoteIp'
  },
  {
    title: '地址',
    field: 'location'
  },
  {
    title: '浏览器',
    field: 'browser'
  },
  {
    title: '操作系统',
    field: 'os'
  },
  {
    title: '访问类型',
    field: 'displayTitle'
  },
  {
    title: '访问时间',
    field: 'createTime',
    visible: false
  }
] as VxeGridPropTypes.Columns;
